<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	Mar 21, 2012
 ^
 + Project: 		WRecruit
 * File Name:	views/jobseeker/tmpl/view_resume.php
 ^ 
 * Description: template for view resume
 ^ 
 * History:		NONE
 ^ 
 */

defined('_JEXEC') or die('Restricted access');
jimport('joomla.html.pane');
 global $mainframe;
$version = new JVersion;
$joomla = $version->getShortVersion();
$jversion = substr($joomla,0,3);
$resume_style = $this->config['resume_style'];

 $isodd = 0; 
$pane =& JPane::getInstance('tabs');
$big_field_width = 40;
$med_field_width = 25;
$sml_field_width = 15;

$section_personal = 1;
$section_basic = 1;
$section_addresses = 0;
$section_sub_address = 0;
$section_sub_address1 = 0;
$section_sub_address2 = 0;
$section_education = 0;
$section_sub_institute = 0;
$section_sub_institute1 = 0;
$section_sub_institute2 = 0;
$section_sub_institute3 = 0;
$section_employer = 0;
$section_sub_employer = 0;
$section_sub_employer1 = 0;
$section_sub_employer2 = 0;
$section_sub_employer3 = 0;
$section_skills = 0;
$section_resumeeditor = 0;
$section_references = 0;
$section_sub_reference = 0;
$section_sub_reference1 = 0;
$section_sub_reference2 = 0;
$section_sub_reference3 = 0;

if( isset($this->fieldsordering))
foreach($this->fieldsordering as $field){ 
	switch ($field->field){
		case "section_addresses" :	$section_addresses = $field->published;	break;
		case "section_sub_address" :	$section_sub_address = $field->published;	break;
		case "section_sub_address1" :	$section_sub_address1 = $field->published;	break;
		case "section_sub_address2" :	$section_sub_address2 = $field->published;	break;
		case "section_education" :	$section_education = $field->published;	break;
		case "section_sub_institute" :	$section_sub_institute = $field->published;	break;
		case "section_sub_institute1" : $section_sub_institute1 = $field->published; break;
		case "section_sub_institute2" :	$section_sub_institute2 = $field->published; break;
		case "section_sub_institute3" :	$section_sub_institute3 = $field->published; break;
		case "section_employer" :	$section_employer = $field->published; break;
		case "section_sub_employer" :	$section_sub_employer = $field->published; break;
		case "section_sub_employer1" :	$section_sub_employer1 = $field->published;	break;
		case "section_sub_employer2" :	$section_sub_employer2 = $field->published;	break;
		case "section_sub_employer3" :	$section_sub_employer3 = $field->published; break;
		case "section_skills" :	$section_skills = $field->published; break;
		case "section_resumeeditor" :	$section_resumeeditor = $field->published; break;
		case "section_references" :	$section_references = $field->published; break;
		case "section_sub_reference" :	$section_sub_reference = $field->published; break;
		case "section_sub_reference1" :	$section_sub_reference1 = $field->published; break;
		case "section_sub_reference2" :	$section_sub_reference2 = $field->published; break;
		case "section_sub_reference3" :	$section_sub_reference3 = $field->published; break;
	}
}
$document =& JFactory::getDocument();
$document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);
?>
<?php if ($this->config['offline'] == '1'){ ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	<?php echo $this->config['title']; ?></td></tr>
	<tr><td height="25"></td></tr>
	<tr><td class="wrecruitmsg">
		<?php echo $this->config['offline_text']; ?>
	</td></tr>	
</table>	
<?php }else{ ?>
<div style="padding: 10px 0 8px 10px;border: 2px solid #e1e1e1">
		<div style="float: left;width: 175px;padding-right: 10px;" class="b-leftcontent">
			<div class="panel-employee">Employee Control Pannel</div>
			<hr style="width: 75%;border:1px solid #fe7613" />
			<?php 
			if (sizeof($this->employerlinks) != 0){				
				echo '<ul>';
				foreach($this->employerlinks as $lnk)	{ ?>
					<li class="b-left-list" <?php /*if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  */?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
					</li>
				<?php }
				echo '</ul>';			
			}
			?>
		</div>
		<div style="float: left;width: 73%">
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	
	<!--<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	
		<?php //echo $this->config['title']; ?>
	</td>
	</tr>
	<tr><td height="23"></td></tr>-->
	<?php /*if ($this->config['cur_location'] == 1) {?>
	<tr><td height="0"></td></tr>
	<tr><td class="curloc">
		<?php $vm = $this->vm; 
			if ($vm == '1'){ //my resume ?> 
			<?php echo JText::_('JS_CUR_LOC'); ?> : <a href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=myresumes&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk" ><?php echo JText::_('JS_MY_RESUME'); ?></a> > <?php echo JText::_('JS_VIEW_RESUME'); ?>
		<?php }elseif ($vm == '2'){ //view resume ?> 
			<?php echo JText::_('JS_CUR_LOC'); ?> : <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=alljobsappliedapplications&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_APPLIED_RESUME'); ?></a> > <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=job_appliedapplications&bd=<?php echo $this->bd; ?>&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_JOB_APPLIED_APPLICATIONS'); ?></a> > <?php echo JText::_('JS_VIEW_EMP_APP'); ?>			
		<?php }elseif ($vm == '3'){ //search resume ?> 
			<?php echo JText::_('JS_CUR_LOC'); ?> : <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=resumesearch&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_SEARCH_RESUME'); ?></a> > <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=resume_searchresults&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_RESUME_SEARCH_RESULT'); ?></a> > <?php echo JText::_('JS_VIEW_RESUME'); ?>
		<?php }elseif ($vm == '4'){ //short list ?>
			<?php echo JText::_('JS_CUR_LOC'); ?> : <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=myjobs&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_MY_JOBS'); ?></a> > <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=job_appliedapplications&bd=<?php echo $this->bd; ?>&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_SHORT_LIST_CANDIDATES'); ?></a> > <?php echo JText::_('JS_VIEW_RESUME'); ?>
		<?php }elseif ($vm == '5'){ //folder resume ?>
			<?php echo JText::_('JS_CUR_LOC'); ?> : <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=myfolders&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_MY_FOLDERS'); ?></a> > <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=folder_resumes&fd=<?php echo $this->fd; ?>&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_VIEW_FOLDER_RESUME'); ?></a> > <?php echo JText::_('JS_VIEW_RESUME'); ?>
		<?php } ?>	
	</td></tr>
	<?php }*/ ?>
	
		<?php 
			/*if (sizeof($this->employerlinks) != 0){
				echo '<tr><td><div id="toplinks"><ul>';
				foreach($this->employerlinks as $lnk)	{ ?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
					</span>
				<?php }
				echo '<ul></div></td></tr>';
			}*/
		?>
		
	
		<?php 
			/*if (sizeof($this->jobseekerlinks) != 0){
				echo '<tr><td><div id="toplinks"><ul>';
				foreach($this->jobseekerlinks as $lnk)	{ ?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
					</span>
				<?php }
				echo '<ul></div></td></tr>';
			}*/ 
		?>
		
	<tr><td height="3"></td></tr>
	<tr><td class="<?php //echo $this->theme['heading']; ?>" align="center">
		<div class="head-title">
			<h2><?php echo JText::_('CV_REVIEW'); ?></h2>
		</div>		
	</td></tr>
	<tr><td height="3"></td></tr>
</table>
<?php
$printform = 1;
	$printform = 1;
	if ((isset($this->resume)) &&($this->resume->id != 0)) { // not new form

                if ($this->resume->status == 1) { // Employment Application is actve
			$printform = 1;
		}elseif($this->resume->status == 0){ // not allowed job posting
			$printform = 0;
			echo "<font color='red'><strong>" . JText::_('JS_RESUME_WAIT_APPROVAL') . "</strong></font>";
		} else{ // not allowed job posting
			$printform = 0;
			echo "<font color='red'><strong>" . JText::_('JS_RESUME_REJECT') . "</strong></font>";
		}
		if ($vm == 1){
			if ($this->resume->uid != $this->uid){ // job seeker can't see other job seeker resume
				$printform = 0;
				//Update by Vireak on 09/08/2012
				//Add frame to this warning and some styling
				//---------------------
				echo '<div class="box-list"><div class="head-title"><h2>Oop!</h2></div>';
				echo '<span class="wr_info"><p>'.JText::_('JS_YOU_ARE_NOT_ALLOWED_TO_VIEW').'</p>';
				echo '<p>This page is reserved for the authorized candidates only. </p></span>';
				echo '</div>';
				//---------------------
			}
		}
	}elseif($this->canview == 0){
			$printform = 0;
			echo "<font color='red'><strong>" . JText::_('JS_YOU_CAN_NOT_VIEW_RESUME_DETAIL') . "</strong></font>";
			//Update by Vireak on 09/08/2012
			//Add frame to this warning and some styling
			//---------------------
			echo '<div class="box-list"><div class="head-title"><h2>Oop!</h2></div>';
			echo '<span class="wr_info"><p>'.JText::_('JS_YOU_CAN_NOT_VIEW_RESUME_DETAIL').'</p>';
			echo '<p>This page is reserved for the authorized employers or recruiters only. </p></span>';
			echo '</div>';
			//---------------------
        }

if ($printform == 1) {
	if(isset($this->resume)){
?>			<?php //print_r($this->resume);exit;?>
			<div style="padding: 10px;background: #f1f1f1;border: 1px solid #d3d3d3">
				<div style="float: left; width: 57%">
					<table cellpadding="0" cellspacing="10" border="0" width="100%" >
					<tr>
						<td class="review_title" width="120"><?php echo JText::_('JS_CV_TITLE'); ?></td>
						<td><?php if (isset($this->resume)) echo $this->resume->application_title;?></td>
					</tr>
					<tr>
						<td class="review_title"><?php echo JText::_('JS_NAME'); ?></td>
						<td><strong><?php
							echo ($this->resume->first_name) ? strtoupper($this->resume->first_name)." ": "";
							echo ($this->resume->middle_name) ? strtoupper($this->resume->middle_name)." ": "";
							echo ($this->resume->last_name) ? strtoupper($this->resume->last_name)." ": "";  
						?></strong></td>
					</tr>
					<tr>
						<td class="review_title"><?php echo JText::_('JS_GENDER');  ?></td>
						<td>
							<?php if(isset($this->resume)) echo ($this->resume->gender == 1) ? JText::_('JS_MALE') : JText::_('JS_FEMALE'); ?>
						</td>
					</tr>
					<tr>
						<td class="review_title"><?php echo JText::_('JS_HEIGHTEST_EDUCATION'); ?></td>
						<td><?php 
							echo $this->resume->heighesteducationtitle; 
						?></td>
					</tr>
					<tr>
						<td class="review_title"><?php echo JText::_('JS_CAREER_DOMAIN'); ?></td>
						<td><?php 
							echo $this->resume->categorytitle;
						?></td>
					</tr>
					<tr>
						<td class="review_title"><?php echo JText::_('JS_EXPECTED_SALARY'); ?></td>
						<td><?php 
							 echo $this->resume->symbol.$this->resume->rangestart.' - '.$this->resume->symbol.$this->resume->rangeend .' '. JText::_('JS_PERMONTH');
						?></td>
					</tr>
					<tr>
						<td class="review_title"><?php echo JText::_('JS_DATEPOSTED'); ?></td>
						<td><?php //echo date($this->config['date_format'],strtotime($this->resume->create_date)); ?>
						<?php if (isset($this->resume)) 
									echo date($this->config['date_format'],strtotime($this->resume->date_start));?></td>
					</tr>
					</table>
				</div>
				<div style="float: right;padding-right: 10px;min-width: 40%;text-align: right">
					<div class="wrecruit_resumeimg" style="float: right;width: 100px;height: 98px;border: 1px solid #dfdfdf" >							
		                    <?php if($resume->photo != '') { ?>
							<img  src="<?php echo $this->config['data_directory']; ?>/data/jobseeker/resume_<?php echo $resume->id ; ?>/photo/<?php echo $resume->photo ; ?>" width="150px" height="150px" title="picture"  alt="Resume Photo"/>
						<?php } ?>
					</div>
					<div style="clear: both"></div>
					<div style="height: 30px;">&nbsp;</div>
		            <div>Add to your candidate list</div>
					<div>
						<?php $link = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=view_resume&vm=3&rd='.$basic->id.'&bd=0&Itemid='.$this->Itemid; ?>						
						<a class="reqestdetail" href="<?php //echo $link?>"><strong><?php echo JText::_('download full CV in PDF'); ?></strong></a>
					</div>
				</div>
				<div style="clear: both"></div>
			</div>
			<div style="height: 10px">&nbsp;</div>			
			<table cellpadding="0" cellspacing="1" width="100%" style="background: #d3d3d3;">
			<tr style="background: #f1f1f1;font-weight: bold;font-size: 14px;" valign="middle" height="30">
				<td valign="middle" style="padding-left: 10px"><?php echo JText::_('Contact info');?></td>
			</tr>
			<tr style="background: #FFFFFF;" height="30">
				<td valign="middle" style="padding-left: 10px">
					<table cellpadding="0" cellspacing="10" border="0" width="100%" >
					<tr>
						<td class="review_title" width="120"><?php echo JText::_('Email'); ?></td>
						<td><?php if (isset($this->resume)) echo $this->resume->email_address;?></td>
					</tr>
					<tr>
						<td class="review_title"><?php echo JText::_('Tel'); ?></td>
						<td><?php
							if (isset($this->resume)) echo $this->resume->home_phone." / ";
							if (isset($this->resume)) echo $this->resume->work_phone;
						?></td>
					</tr>
					<tr>
						<td class="review_title"><?php echo JText::_('Address');  ?></td>
						<td>
							<?php if(isset($this->resume)) echo ($this->resume->gender == 1) ? JText::_('JS_MALE') : JText::_('JS_FEMALE'); ?>
						</td>
					</tr>
					</table>			
				</td>
			</tr>
			</table>
			<div style="height: 10px">&nbsp;</div>			
			<table cellpadding="0" cellspacing="1" width="100%" style="background: #d3d3d3;">
			<tr style="background: #f1f1f1;font-weight: bold;font-size: 14px;" valign="middle" height="30">
				<td valign="middle" style="padding-left: 10px"><?php echo JText::_('Career objective');?></td>
			</tr>
			<tr style="background: #FFFFFF;" height="100" >
				<td style="padding-left: 10px;padding-top: 10px" valign="top">
					<?php echo JText::_('Candidate\'s career objective goes here...'); ?>			
				</td>
			</tr>
			</table>
			
			<div style="height: 10px">&nbsp;</div>			
			<table cellpadding="0" cellspacing="1" width="100%" style="background: #d3d3d3;">
			<tr style="background: #f1f1f1;font-weight: bold;font-size: 14px;" valign="middle" height="30">
				<td valign="middle" style="padding-left: 10px"><?php echo JText::_('Professional experiences');?></td>
			</tr>
			<tr style="background: #FFFFFF;" height="100" >
				<td style="padding-left: 10px;padding-top: 10px" valign="top">
					<?php echo JText::_('Candidate\'s career objective goes here...'); ?>			
				</td>
			</tr>
			</table>			
			<div style="height: 10px">&nbsp;</div>			
			<table cellpadding="0" cellspacing="1" width="100%" style="background: #d3d3d3;">
			<tr style="background: #f1f1f1;font-weight: bold;font-size: 14px;" valign="middle" height="30">
				<td valign="middle" style="padding-left: 10px"><?php echo JText::_('Education/traning');?></td>
			</tr>
			<tr style="background: #FFFFFF;" height="100" >
				<td style="padding-left: 10px;padding-top: 10px" valign="top">
					<?php echo JText::_('Candidate\'s career objective goes here...'); ?>			
				</td>
			</tr>
			</table>
			
			<div style="height: 10px">&nbsp;</div>			
			<table cellpadding="0" cellspacing="1" width="100%" style="background: #d3d3d3;">
			<tr style="background: #f1f1f1;font-weight: bold;font-size: 14px;" valign="middle" height="30">
				<td valign="middle" style="padding-left: 10px"><?php echo JText::_('Skills');?></td>
			</tr>
			<tr style="background: #FFFFFF;" height="100" >
				<td style="padding-left: 10px;padding-top: 10px" valign="top">
					<?php echo JText::_('Candidate\'s career objective goes here...'); ?>			
				</td>
			</tr>
			</table>
			
			<div style="height: 10px">&nbsp;</div>			
			<table cellpadding="0" cellspacing="1" width="100%" style="background: #d3d3d3;">
			<tr style="background: #f1f1f1;font-weight: bold;font-size: 14px;" valign="middle" height="30">
				<td valign="middle" style="padding-left: 10px"><?php echo JText::_('References');?></td>
			</tr>
			<tr style="background: #FFFFFF;" height="100" >
				<td style="padding-left: 10px;padding-top: 10px" valign="top">
					<?php echo JText::_('Candidate\'s career objective goes here...'); ?>			
				</td>
			</tr>
			</table>
			
			
			<?php 
				if(isset($this->resume)) {
					if (($this->resume->create_date=='0000-00-00 00:00:00') || ($this->resume->create_date==''))
						$curdate = date('Y-m-d H:i:s');
					else  
						$curdate = $this->resume->create_date;
				}else
					$curdate = date('Y-m-d H:i:s');
				
			?>
	</div>    
    <div style="clear: both"></div>
</div>
<?php
	}else {
	echo JText::_('JS_RESULT_NOT_FOUND'); 
}	
} else{ // not allowed job posting
echo JText::_('JS_YOU_ARE_NOT_ALLOWED_TO_VIEW');
}	

}//ol

?>
<div width="100%">
<?php 
if($this->config['fr_cr_txsh']) {
	echo 
	'<table width="100%" style="table-layout:fixed;">
		<tr><td height="15"></td></tr>
		<tr><td style="vertical-align:top;" align="center">'.$this->config['fr_cr_txa'].$this->config['fr_cr_txb'].'</td></tr>
	</table>';
}	
?>
</div>
<script language=Javascript>

	function hideshowtables(table_id){
			hideall();
			//alert(document.getElementById(table_id).style.display);
			document.getElementById(table_id).style.display = "block";
			//alert(document.getElementById(table_id).style.display);

	}
	function hideall(){
		document.getElementById('personal_info_data').style.display = "none";
		document.getElementById('addresses_data').style.display = "none";
		document.getElementById('education_data').style.display = "none";
		document.getElementById('employer_data').style.display = "none";
		document.getElementById('skills_data').style.display = "none";
		document.getElementById('resume_editor_data').style.display = "none";
		document.getElementById('references_data').style.display = "none";
	}
//window.onLoad=dochange('country', -1);         // value in first dropdown
<?php if($resume_style == 'sliding'){ ?>
	hideshowtables('personal_info_data');
<?php } ?>

</script>
		